package com.example.prgraphview1;

import android.content.Context;
import android.widget.LinearLayout;

import com.jjoe64.graphview.GraphView;
import com.jjoe64.graphview.GraphViewSeries;
import com.jjoe64.graphview.LineGraphView;

/**
 * Created by esalazar on 7/11/13.
 */
public class GraphViewGraphicMaker implements GraphicMaker {

    LinearLayout layout;
    Context context;

    public GraphViewGraphicMaker( LinearLayout layout,
            Context context) {
        this.context = context;
        this.layout = layout;

    }
    @Override
    public void paint() {
        GraphViewSeries exampleSeries = new GraphViewSeries(new GraphView.GraphViewData[] {
                new GraphView.GraphViewData(1, 2.0d)
                , new GraphView.GraphViewData(2, 1.5d)
                , new GraphView.GraphViewData(3, 2.5d)
                , new GraphView.GraphViewData(4, 1.0d)
        });

        GraphView graphView = new LineGraphView(
                context // context
                , "GraphViewDemo" // heading
        );
        graphView.addSeries(exampleSeries); // data

        layout.addView(graphView);
    }
}
